<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>studying</title>
    <link rel="stylesheet" href="/public/bootstrap-3.3.7/css/bootstrap.css">
    <link rel="stylesheet" href="/public/css/index.css">
    <script src="/public/js/jquery-3.2.1.min.js"></script>

</head>

<body>
    <div class="blog-masthead">
        <div class="container">
            <nav class="blog-nav">
                {% if category == '' %}
                <a class="blog-nav-item active" href="/">首页</a>
                {% else %}
                <a class="blog-nav-item" href="/">首页</a>
                {% endif %}

                {% for cate in categories %}
                {% if category == cate._id.toString() %}
                <a class="blog-nav-item active" href="/?category={{cate._id.toString()}}">{{cate.name}}</a>
                {% else %}
                <a class="blog-nav-item" href="/?category={{cate._id.toString()}}">{{cate.name}}</a>
                {% endif %}

                {% endfor %}
            </nav>
        </div>
    </div>

    <div class="container">

        <div class="blog-header">
            <h1 class="blog-title"></h1>
        </div>

        <div class="row">

            <div class="col-sm-8 blog-main">
                {% block content %}{% endblock %}
            </div><!-- /.blog-main -->

            <div class="col-sm-3 col-sm-offset-1 blog-sidebar">

                {% if userInfo._id %}
                <div class="sidebar-module sidebar-module-inset " id="userInfo">
                    {% if userInfo.isAdmin %}
                    <h4 id="username"> {{userInfo.username}} </h4>你好管理员!
                    <a href="/admin" target="_blank">进入管理</a>
                    {% else %}
                    <h4 id="username"> {{userInfo.username}} </h4>欢迎光临我的博客!
                    {% endif %}
                    <a href="javascript:;" id="logout">退出</a>
                    <!-- <p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet
                        fermentum. Aenean lacinia bibendum nulla sed consectetur.</p> -->
                </div>
                {% else %}
                <!-- 登录框start -->
                <div class="sidebar-module sidebar-module-inset " id="loginBox">
                    <form class="form-signin">
                        <h2 class="form-signin-heading">登录</h2>
                        <input type="text" name="username" class="form-control" placeholder="用户名" required autofocus value="">
                        <input type="password" name="password" class="form-control" placeholder="密码" required value="">
                        <!-- <div class="checkbox">
                            <label>
                                <input type="checkbox" value="remember-me"> 记住我
                            </label>
                        </div> -->
                        <button class="btn btn-lg btn-primary btn-block" type="submit">登 录</button>
                        <a href="javascript:;" class="checkbox switch">点击注册</a>
                        <div class="displayNone alert alert-danger text-center mes" role="alert"></div>
                    </form>
                </div>
                <!-- 登录框end -->

                <!-- 注册框start -->
                <div class="sidebar-module sidebar-module-inset displayNone" id="registerBox">
                    <form class="form-signin">
                        <h2 class="form-signin-heading">注册</h2>
                        <input type="text" name="username" class="form-control" placeholder="用户名" required autofocus>
                        <input type="password" name="password" class="form-control" placeholder="密码" required>
                        <input type="password" name="repassword" class="form-control" placeholder="再次确认密码" required>
                        <button class="btn btn-lg btn-primary btn-block" type="submit">注 册</button>
                        <a href="javascript:;" class="checkbox switch">点击登录</a>
                        <div class="displayNone alert alert-danger text-center mes" role="alert"></div>
                    </form>
                </div>
                <!-- 注册框end -->
                {% endif %}
                <!-- <div class="sidebar-module">
                    <h4>Archives</h4>
                    <ol class="list-unstyled">
                        <li><a href="#">March 2014</a></li>
                        <li><a href="#">February 2014</a></li>
                        <li><a href="#">January 2014</a></li>
                        <li><a href="#">December 2013</a></li>
                        <li><a href="#">November 2013</a></li>
                        <li><a href="#">October 2013</a></li>
                        <li><a href="#">September 2013</a></li>
                        <li><a href="#">August 2013</a></li>
                        <li><a href="#">July 2013</a></li>
                        <li><a href="#">June 2013</a></li>
                        <li><a href="#">May 2013</a></li>
                        <li><a href="#">April 2013</a></li>
                    </ol>
                </div>
                <div class="sidebar-module">
                    <h4>Elsewhere</h4>
                    <ol class="list-unstyled">
                        <li><a href="#">GitHub</a></li>
                        <li><a href="#">Twitter</a></li>
                        <li><a href="#">Facebook</a></li>
                    </ol>
                </div> -->
            </div><!-- /.blog-sidebar -->

        </div><!-- /.row -->

    </div><!-- /.container -->

    <footer class="blog-footer">
        <p>Power by duan</p>
        <p>
            <a href="#">返回顶部</a>
        </p>
    </footer>

    <script src="/public/js/index.js"></script>
</body>

</html>